package bb.lanxing.devicelist.tool;

//import com.alipay.sdk.authjs.a;
//import bb.lanxing.lib.kt.SingletonHolder;
import bb.lanxing.lib.kt.SingletonHolder;
import bb.lanxing.lib.kt.XossCoroutineScopeKt;
//import bb.lanxing.lib.kt.util.Constant;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.Dispatchers;
/* compiled from: XossModelUtil.kt */

public final class XossModelUtil {
//    public static final Companion Companion = new Companion(null);

    public enum XossGSerial {
        N1("n1"),
        N2("n2"),
        N3("n3"),
        N4("n4"),
        N5("n5"),
        N6("n6"),
        N7("n7"),
        N8("n8");
        
        public static final Companion Companion = new Companion(null);
        private final String model;

        XossGSerial(String str) {
            this.model = str;
        }

        public final String getModel() {
            return this.model;
        }

        public static final class Companion {
            public Companion(DefaultConstructorMarker defaultConstructorMarker) {
                this();
            }

            private Companion() {
            }

            public final XossGSerial from(String str) {
                XossGSerial[] values;
                for (XossGSerial xossGSerial : XossGSerial.values()) {
                    if (StringsKt.equals(xossGSerial.getModel(), str, true)) {
                        return xossGSerial;
                    }
                }
                return null;
            }
        }
    }

    public enum XossNAVSerial {
        A1("A1"),
        A2("A2");
        
        public static final Companion Companion = new Companion(null);
        private final String model;

        XossNAVSerial(String str) {
            this.model = str;
        }

        public final String getModel() {
            return this.model;
        }

        public static final class Companion {
            public Companion(DefaultConstructorMarker defaultConstructorMarker) {
                this();
            }

            private Companion() {
            }

            public final XossNAVSerial from(String str) {
                XossNAVSerial[] values;
                for (XossNAVSerial xossNAVSerial : XossNAVSerial.values()) {
                    if (StringsKt.equals(xossNAVSerial.getModel(), str, true)) {
                        return xossNAVSerial;
                    }
                }
                return null;
            }
        }
    }

    /*public static final class Companion extends SingletonHolder<XossModelUtil> {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        class AnonymousClass1 extends FunctionReferenceImpl implements Function0<XossModelUtil> {
            public final AnonymousClass1 INSTANCE = new AnonymousClass1();

            AnonymousClass1() {
                super(0, XossModelUtil.class, "<init>", "<init>()V", 0);
            }

            @Override
            public final XossModelUtil invoke() {
                return new XossModelUtil();
            }
        }

        private Companion() {
            super(AnonymousClass1.INSTANCE);
        }
    }*/

    public final boolean isGen1Model(Integer num, String str) {
        XossGSerial from = XossGSerial.Companion.from(str);
        if (num != null && num == 17 && from != null) {
            switch (from) {
                case N1, N2, N3, N4 -> {
                    return true;
                }
                case N5, N6, N7, N8 -> {
                    return false;
                }
                default -> throw new NoWhenBranchMatchedException();
            }
        }
        return true;
    }

    public final boolean isGen2Model(Integer num, String str) {
        XossGSerial from = XossGSerial.Companion.from(str);
        if (num == null || num != 17 || from == null) {
            return true;
        }
        return switch (from) {
            case N1, N2, N3, N4 -> false;
            case N5, N6, N7, N8 -> true;
            default -> throw new NoWhenBranchMatchedException();
        };
    }

    public final boolean isGDevice(Integer num, String str) {
        XossGSerial from = XossGSerial.Companion.from(str);
//        int i;
        return num == null || num != 17 || from  == null || from == XossGSerial.N1 || from == XossGSerial.N4;
    }

    public final boolean isGPlusDevice(Integer num, String str) {
        XossGSerial from = XossGSerial.Companion.from(str);
//        int i;
        return num == null || num != 17 || from == null || from == XossGSerial.N2 || from == XossGSerial.N3;
    }

    public final boolean isG2Device(Integer num, String str) {
        XossGSerial from = XossGSerial.Companion.from(str);
//        int i;
        return num == null || num != 17 || from == null || from == XossGSerial.N5 || from == XossGSerial.N7;
    }

    public final boolean isG2PlusDevice(Integer num, String str) {
        XossGSerial from = XossGSerial.Companion.from(str);
//        int i;
        return num == null || num != 17 || from == null || from == XossGSerial.N6 || from == XossGSerial.N8;
    }

    public final void getDeviceModel(String address, Function1<? super XossGSerial, Unit> callback) {
//        Intrinsics.checkNotNullParameter(address, "address");
//        Intrinsics.checkNotNullParameter(callback, "callback");
//        BuildersKt.launch$default(XossCoroutineScopeKt.getXossCoroutineScope(),
//                Dispatchers.getIO(), null, new XossModelUtil$getDeviceModel$1(address, callback, null), 2, null);
    }
}
